from django.shortcuts import HttpResponse,render
import json
import datetime

def get_app02(r):
    print(r) #请求的信息对象
    return HttpResponse("app02解耦测试")



#post 请求
def get_app02_1(r):
    # 请求的信息对象
    print(r.method)
    print(r.path)
    print(r.GET)
    print(r.POST)
    print(r.body)
    #解析json数据
    json_data = json.loads(r.body.decode('utf-8'))
    print(json_data['aa'])
    return HttpResponse("psot")


#模板页面
def get_app02_2(r):
    t = str(datetime.datetime.now())
    return render(r,template_name="index.html",context={"now":t})